package 课堂作业api_day3;

import java.util.Scanner;
//需求2：统计字符次数（StringBuilder完成）
//设定一个有大小写字母的字符串，先将字符串的大写字符输出，再将字符串中的小写字符输出。
public class TestDemo2{
    public static void main(String[] args) {
        System.out.println("请输入字符串：");
        Scanner scan = new Scanner(System.in);
        String str = scan.nextLine();
        char[] s = str.toCharArray();
        System.out.print("小写字母: ");
        for (char s1:s) {
            if(Character.isLowerCase(s1))
                System.out.print(s1+" ");
        }
        System.out.println();
        System.out.print("大写字母：");
        for (char s2:s) {
            if (Character.isUpperCase(s2))
                System.out.print(s2+" ");
        }
        System.out.println();
        System.out.print("数字：");
        for (char s3:s) {
            if (Character.isDigit(s3))
                System.out.print(s3+" ");

        }

    }
}

